import { Space,Typography } from "antd";
import { FC } from "react";
const {Paragraph} = Typography

export type questionParagraph_propsType = {
    text?:string,
    iscenter?:boolean

    islock?:boolean
    onchange?:(newprops:questionParagraph_propsType)=>void
}

 export const questionParagraph_defaultValue:questionParagraph_propsType = {
    text:'问卷段落',
    iscenter:false
}

const QuestionParagraph:FC<questionParagraph_propsType> = (props)=>{
    const {text,iscenter} = props
    const textList = text?.split('\n')
    return <>
    <Space direction='vertical' style={{width:'100%'}}>
        <Paragraph style={{textAlign:iscenter?'center':'start',fontWeight:'bold',margin:0}}>
            {
               textList?.map((item,index)=>{
                return (
                    <span key={index}>
                      {index > 0 ? <br /> : null}
                      {item}
                    </span>
                  );
               })
            }
        </Paragraph>
    </Space>
    </>
}

export default QuestionParagraph